/**
 * Created by Administrator on 2016/8/5.
 */
$(window).scroll(function(event) {
    var scroll = $(window).scrollTop();
    var m = -1;
    if (scroll >= 653) {
        $('.left-sidebar').fadeIn(300);
    } else {
        $('.left-sidebar').fadeOut(1000);
    }
    var floor = ["1035px","1530px","2135px","2745px","3480px","4110px","4715px","5320px","5930","6540","6860"];
    $('.left-sidebar li').click(function(){
        k = $(this).index();
        $('html,body').stop().animate({scrollTop:floor[k]},500);
    });
    if (scroll >= 1035 && scroll < 1530) {
        m = 0;
    }else if (scroll >= 1530 && scroll < 2135) {
        m = 1;
    }else if (scroll >= 2135 && scroll < 2745) {
        m = 2;
    }else if (scroll >= 2745 && scroll < 3480) {
        m = 3;
    }else if (scroll >= 3490 && scroll < 4110) {
        m = 4;
    }else if (scroll >= 4110 && scroll < 4715) {
        m = 5;
    }else if (scroll >= 4715 && scroll < 5320) {
        m = 6;
    }else if (scroll >= 5320 && scroll < 5930) {
        m = 7;
    }else if (scroll >= 5930 && scroll < 6540) {
        m = 8;
    }else if (scroll >= 6540 && scroll < 6860) {
        m = 9;
    }else if (scroll >= 6860) {
        m = 10;
    }else{
        m = -1
    }
    if(m == -1){
        $('.left-sidebar li').removeClass('cur');
    }else{
        $('.left-sidebar li').eq(m).addClass('cur').siblings().removeClass("cur");
    }
    if (scroll >= 715) {
        $('.right-sidebar4').show();
    } else {
        $('.right-sidebar4').hide();
    }

    $('.right-sidebar li').hover(function(){
        $('.right-sidebar li').eq($(this).index()).find('p').show().parent().siblings().find('p').hide();
        if($(this).index() == 1){
            $('.right-sidebar2 .weixin').animate({right:'60px',opacity:'1'}).show();
        }else{
            $('.right-sidebar2 .weixin').hide();
        }
        if($(this).index() == 2){
            $('.right-sidebar3 .weixin').animate({right:'60px',opacity:'1'}).show();
        }else{
            $('.right-sidebar3 .weixin').hide();
        }
    },function(){
        $('.right-sidebar li').find('p').hide();
        $('#sidebar .weixin').hide();
    });
    $('.right-sidebar4').click(function(){
        $(document).scrollTop(0);
    });
    if(scroll >= 1180){
        $('.hiddenBox').fadeIn();
    }else if(scroll <= 856){
        $('.hiddenBox').fadeOut();
    }


});